package com.moody.init;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import com.moody.hibernate.domain.ModelInfo;
import com.moody.service.ModelService;
import com.moody.service.impl.ModelServiceImpl;


import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;


/*
 * @Title: ReadExcel.java 
 * @Package：  
 * @author： Liu Peng
 * @Description: 读取Excel文件   
 * @date： 2012-3-12 下午01:10:17
 * @Modified by: Liu Peng 
 * @version V1.0   
 */

public class ModelInfoInit {
	/*
	 * 当添加新文件时需要做如下几步：
	 * 1. 更改filePath
	 * 2. 使用系统新建一个打分卡模型，并在数据库中获得其modelId，更改代码中的modelId
	 * 3. 更改扫描行范围，因为代码未处理越界情况
	 */
	static String filePath1 = "D:\\制造业打分卡V7.xls";
    static char custKind1 = 'E';
    static String modelId1 = "8a810b8135f016c20135f02897ed0014";
	final static int ROWMIN1 = 16;//从第一个子类因素行开始扫描
    final static int ROWMAX1 = 47;
	final static int ROWMIN1_N = 16;
    final static int ROWMAX1_N = 81;

	static String filePath2 = "D:\\事业单位打分卡V5.xls";
    static char custKind2 = 'P';
    static String modelId2 = "ff808081360f9ebf01360fb624bc0030";
	final static int ROWMIN2 = 16;
    final static int ROWMAX2 = 41;
	final static int ROWMIN2_N = 16;
    final static int ROWMAX2_N = 68;
    
	static String filePath3 = "D:\\批发零售打分卡revised_v3.xls";
    static char custKind3 = 'E';
    static String modelId3 = "ff808081360fc9af01360fd237860028";
	final static int ROWMIN3 = 16;
    final static int ROWMAX3 = 52;
	final static int ROWMIN3_N = 15;
    final static int ROWMAX3_N = 76;
    
    
	static String filePath4 = "D:\\服务业打分卡V5.xls";
    static char custKind4 = 'E';
    static String modelId4 = "ff808081360ff27b01360ff338060013";
	final static int ROWMIN4 = 16;
    final static int ROWMAX4 = 52;
	final static int ROWMIN4_N = 15;
    final static int ROWMAX4_N = 67;
    
    static String filePath5 = "D:\\产生收入的房地产.xls";
    static char custKind5 = 'E';
    static String modelId5 = "ff808081365d28a001365d2c85040013";
	final static int ROWMIN5 = 16;
    final static int ROWMAX5 = 32;
	final static int ROWMIN5_N = 15;
    final static int ROWMAX5_N = 71;
    
    static String filePath6 = "D:\\非银行类金融机构.xls";
    static char custKind6 = 'F';
    static String modelId6 = "ff808081365d951501365d99f8900047";
	final static int ROWMIN6 = 16;
    final static int ROWMAX6 = 52;
	final static int ROWMIN6_N = 15;
    final static int ROWMAX6_N = 47;
    
    static String filePath7 = "D:\\建筑业.xls";
    static char custKind7 = 'E';
    static String modelId7 = "402881f2365e798001365e7bb19d0052";
	final static int ROWMIN7 = 16;
    final static int ROWMAX7 = 47;
	final static int ROWMIN7_N = 15;
    final static int ROWMAX7_N = 62;
    
    static String filePath8 = "D:\\交通运输与仓储业.xls";
    static char custKind8 = 'E';
    static String modelId8 = "402881f2365e8a6801365e92994f005c";
	final static int ROWMIN8 = 16;
    final static int ROWMAX8 = 48;
	final static int ROWMIN8_N = 15;
    final static int ROWMAX8_N = 63;
    
    static String filePath9 = "D:\\农林牧渔业.xls";
    static char custKind9 = 'E';
    static String modelId9 = "402881f2365e952801365e9a67a7005c";
	final static int ROWMIN9 = 16;
    final static int ROWMAX9 = 53;
	final static int ROWMIN9_N = 15;
    final static int ROWMAX9_N = 62;
    
    static String filePath10 = "D:\\项目融资（小型水电项目）.xls";
    static char custKind10 = 'E';
    static String modelId10 = "402881f2365e9b5a01365ea183ae005f";
	final static int ROWMIN10 = 16;
    final static int ROWMAX10 = 32;
	final static int ROWMIN10_N = 15;
    final static int ROWMAX10_N = 62;
    
    static String filePath11 = "D:\\一般中小企业.xls";
    static char custKind11 = 'E';
    static String modelId11 = "402881f2365eaace01365eb02af8004f";
	final static int ROWMIN11 = 16;
    final static int ROWMAX11 = 52;
	final static int ROWMIN11_N = 15;
    final static int ROWMAX11_N = 65;
    
    static String filePath12 = "D:\\再生资源回收.xls";
    static char custKind12 = 'E';
    static String modelId12 = "402881f2365eb19f01365eb4443c0062";
	final static int ROWMIN12 = 16;
    final static int ROWMAX12 = 47;
	final static int ROWMIN12_N = 15;
    final static int ROWMAX12_N = 67;
    
    
    
    static String filePath =filePath12;
    static char custKind = custKind12;
    static String modelId = modelId12;
	final static int ROWMIN = ROWMIN12;
    final static int ROWMAX = ROWMAX12;
	private static final int ROWMIN_N = ROWMIN12_N;
	private static final int ROWMAX_N = ROWMAX12_N;
    
    
//	@Resource
//	private ModelService modelService;
    
    static boolean describeFlag = true; //标识一个大类因素读取开始
    static char levelFlag;
    static String dataFlag; // 标识是财务因素输入还是非财务因素输入
    
    static String describe1,describe2,describe3;
    static String describe2String;
    static String itemDescribe1,itemDescribe2,itemDescribe3,itemDescribe4,itemDescribe5,itemDescribe6,itemDescribe7,itemDescribe8,itemDescribe9,itemDescribe10,itemDescribe11,itemDescribe12;
    static String itemValue1,itemValue2,itemValue3,itemValue4,itemValue5,itemValue6;
    static String weight;
	static List<ModelInfo> list = new ArrayList<ModelInfo>();
	private static ModelService modelService = new ModelServiceImpl();
	
    
	public static void importModelInfoFromExcel_Finan(){ 
		dataFlag = ModelInfo.QUANTITY_FACTOR;
	    Workbook wb = null;   
	    
	    try {   
	    	File file = new File(filePath);
	        //构造Workbook（工作薄）对象   
	        wb=Workbook.getWorkbook(file);   
	    } catch (BiffException e) {   
	        e.printStackTrace();   
	    } catch (IOException e) {   
	        e.printStackTrace();   
	    }   
	       
	    if(wb==null) return;   
	       
	    //获得了Workbook对象之后，就可以通过它得到Sheet（工作表）对象了     
	    Sheet sheetFinancial = wb.getSheet("财务因素输入");
	    
	    if(sheetFinancial!=null){ 
	    	for(int i = ROWMIN; i <= ROWMAX ; i++){
	    		Cell[] cells = sheetFinancial.getRow(i);
	    		if(cells[5] == null || cells[5].getContents().equals("")){//表明空行
	    			describeFlag = true;
	    			continue;
	    		}
	    		if(cells[5].getContents().equals("A")){//表明新的子类因素读取开始
	    			setItemValues();//设置上一个子类因素中每项的itemValue
	    			setWeight(wb); //设置上一个子类因素的权重
	    			String s = describe2String;
	    			String w = weight;
	    			addModelInfoToList();//将上一个子类因素对象插入到列表中(刚开始时被调用，无上一个子类因素，该方法根据判定不会插入列表)
	    			dataReset();//为新的子类清空静态数据
	    			
	    			describe2String = cells[3].getContents();
	    			translateNameToNo();//将describe2转成对应的编号
	    			describe3 = cells[4].getContents();
	    			levelFlag = 'A';
	    		}
	    		if(describeFlag && cells[5].getContents().equals("A")){//表明新的大类因素读取开始
	    			describe1 = cells[2].getContents();
	    			describeFlag = false;
	    			
	    		}
	    		if(cells[5].getContents().equals("B")){
	    			levelFlag = 'B';
	    		}
	    		if(cells[5].getContents().equals("C")){
	    			levelFlag = 'C';
	    		}
	    		if(cells[5].getContents().equals("D")){
	    			levelFlag = 'D';
	    		}
	    		if(cells[5].getContents().equals("E")){
	    			levelFlag = 'E';
	    		}
	    		if(cells[5].getContents().equals("F")){
	    			levelFlag = 'F';
	    		}
	    		setItemDescribes(cells[6].getContents());
	    	}
	    	
	    	setItemValues();//设置最后一个子类因素中每项的itemValue
			setWeight(wb); //设置最后一个子类因素的权重
	    	addModelInfoToList();//将最后一个子类插入到列表中
	    	
	    	
	    }   
	  //批量插入
		modelService.insertModelInfo(list);
    	dataReset();//为新的子类清空静态数据
    	
	    //最后关闭资源，释放内存   
	    wb.close();   
	}
	
	public static void importModelInfoFromExcel_NonFinan(){
		dataFlag = ModelInfo.QUALITY_FACTOR;
		Workbook wb = null;   
	    
	    try {   
	    	File file = new File(filePath);
	        //构造Workbook（工作薄）对象   
	        wb=Workbook.getWorkbook(file);   
	    } catch (BiffException e) {   
	        e.printStackTrace();   
	    } catch (IOException e) {   
	        e.printStackTrace();   
	    }   
	       
	    if(wb==null) return;   
	       
	    //获得了Workbook对象之后，就可以通过它得到Sheet（工作表）对象了     
	    Sheet sheetNonFinancial = wb.getSheet("非财务因素输入");
	    
	    if(sheetNonFinancial!=null){ 
	    	for(int i = ROWMIN_N; i <= ROWMAX_N ; i++){
	    		Cell[] cells = sheetNonFinancial.getRow(i);
	    		if(cells.length < 5 || cells[5] == null || cells[5].getContents().equals("")){//表明空行
	    			describeFlag = true;
	    			continue;
	    		}
	    		if(cells[5].getContents().equals("A")){//表明新的子类因素读取开始
	    			setItemValues();//设置上一个子类因素中每项的itemValue
	    			setWeight(wb); //设置上一个子类因素的权重
	    			String s1 = describe2String;
	    			String w = weight;
	    			addModelInfoToList();//将上一个子类因素对象插入到列表中(刚开始时被调用，无上一个子类因素，该方法根据判定不会插入列表)
	    			dataReset();//为新的子类清空静态数据
	    			
	    			describe2 = cells[3].getContents();
	    			describe2String = cells[3].getContents();
	    			levelFlag = 'A';
	    		}
	    		if(describeFlag && cells[5].getContents().equals("A")){//表明新的大类因素读取开始
	    			describe1 = cells[2].getContents();
	    			describeFlag = false;
	    			
	    		}
	    		if(cells[5].getContents().equals("B")){
	    			levelFlag = 'B';
	    		}
	    		if(cells[5].getContents().equals("C")){
	    			levelFlag = 'C';
	    		}
	    		if(cells[5].getContents().equals("D")){
	    			levelFlag = 'D';
	    		}
	    		if(cells[5].getContents().equals("E")){
	    			levelFlag = 'E';
	    		}
	    		if(cells[5].getContents().equals("F")){
	    			levelFlag = 'F';
	    		}
	    		setItemDescribes(cells[6].getContents());
	    	}
	    	
	    	setItemValues();//设置最后一个子类因素中每项的itemValue
			setWeight(wb); //设置最后一个子类因素的权重
	    	addModelInfoToList();//将最后一个子类插入到列表中
	    	
	    	
	    }   
	  //批量插入
		modelService.insertModelInfo(list);
	    //最后关闭资源，释放内存   
	    wb.close(); 
	}
	
	public static void translateNameToNo(){
		Map<String,String> map = ReportItemInit.getInstance().getReportItem();
		if(map.containsValue(describe2String)){
			List<String> keyList = new ArrayList<String>(map.keySet());
			Iterator<String> it = keyList.iterator();
			while(it.hasNext()){
				String currKey = it.next();
				String currValue = map.get(currKey);
				if(currValue.equals(describe2String)){
					if(custKind == 'E'){//企业法人
						if(currKey.length() == 5){
							describe2 = currKey;
							return;
						}
					}
					else if(custKind == 'P'){//事业单位
						if(currKey.substring(0, 3).equals("PFR")){
							describe2 = currKey;
							return;
						}
						
					}
					else if(custKind == 'F'){//金融同业
						if(currKey.substring(0, 3).equals("FFR")){
							describe2 = currKey;
							return;
						}
						
					}
					else if(custKind == 'S'){//小企业
						if(currKey.substring(0, 3).equals("SFR")){
							describe2 = currKey;
							return;
						}
						
					}
				}
			}
		}
	}
	public static void addModelInfoToList(){
		String nonFinanItemNo = "" + ((int)(Math.random() * 1000) + System.currentTimeMillis());
		if(itemDescribe1!=null &&!itemDescribe1.equals("") && itemDescribe2!=null 
				&&!itemDescribe2.equals("")&& itemValue1!=null && !itemValue1.equals("")){		
			ModelInfo modelInfo = new ModelInfo();
			modelInfo.setModelId(modelId);
			modelInfo.setDataFlag(dataFlag);
			modelInfo.setDescribe1(describe1);
			modelInfo.setDescribe2(describe2);
			modelInfo.setDescribe3(describe3);
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemDescribe("("+itemDescribe1+","+itemDescribe2+")");
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemDescribe(itemDescribe1);
			modelInfo.setItemValue(Double.valueOf(itemValue1));
			if(weight != null && !weight.equals("")) modelInfo.setItemWeight(Double.valueOf(weight));
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemNo(describe2);
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemNo(nonFinanItemNo);
			
			list.add(modelInfo);
			
		}
		
		if(itemDescribe3!=null &&!itemDescribe3.equals("") && itemDescribe4!=null 
				&&!itemDescribe4.equals("")&& itemValue2!=null&& !itemValue2.equals("")){
			ModelInfo modelInfo = new ModelInfo();
			modelInfo.setModelId(modelId);
			modelInfo.setDataFlag(dataFlag);
			modelInfo.setDescribe1(describe1);
			modelInfo.setDescribe2(describe2);
			modelInfo.setDescribe3(describe3);
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemDescribe("("+itemDescribe3+","+itemDescribe4+")");
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemDescribe(itemDescribe3);
			modelInfo.setItemValue(Double.valueOf(itemValue2));
			if(weight != null && !weight.equals(""))modelInfo.setItemWeight(Double.valueOf(weight));
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemNo(describe2);
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemNo(nonFinanItemNo);
			list.add(modelInfo);
		}
		
		if(itemDescribe5!=null &&!itemDescribe5.equals("") && itemDescribe6!=null 
				&&!itemDescribe6.equals("")&& itemValue3!=null && !itemValue3.equals("")){
			ModelInfo modelInfo = new ModelInfo();
			modelInfo.setModelId(modelId);
			modelInfo.setDataFlag(dataFlag);
			modelInfo.setDescribe1(describe1);
			modelInfo.setDescribe2(describe2);
			modelInfo.setDescribe3(describe3);
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemDescribe("("+itemDescribe5+","+itemDescribe6+")");
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemDescribe(itemDescribe5);
			modelInfo.setItemValue(Double.valueOf(itemValue3));
			if(weight != null && !weight.equals(""))modelInfo.setItemWeight(Double.valueOf(weight));
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemNo(describe2);
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemNo(nonFinanItemNo);
			list.add(modelInfo);
		}
		
		if(itemDescribe7!=null &&!itemDescribe7.equals("") && itemDescribe8!=null 
				&&!itemDescribe8.equals("")&& itemValue4!=null && !itemValue4.equals("")){
			ModelInfo modelInfo = new ModelInfo();
			modelInfo.setModelId(modelId);
			modelInfo.setDataFlag(dataFlag);
			modelInfo.setDescribe1(describe1);
			modelInfo.setDescribe2(describe2);
			modelInfo.setDescribe3(describe3);
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemDescribe("("+itemDescribe7+","+itemDescribe8+")");
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemDescribe(itemDescribe7);
			modelInfo.setItemValue(Double.valueOf(itemValue4));
			if(weight != null && !weight.equals(""))modelInfo.setItemWeight(Double.valueOf(weight));
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemNo(describe2);
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemNo(nonFinanItemNo);
			list.add(modelInfo);
		}

		if(itemDescribe9!=null &&!itemDescribe9.equals("") && itemDescribe10!=null 
				&&!itemDescribe10.equals("") && itemValue5!=null && !itemValue5.equals("")){
			ModelInfo modelInfo = new ModelInfo();
			modelInfo.setModelId(modelId);
			modelInfo.setDataFlag(dataFlag);
			modelInfo.setDescribe1(describe1);
			modelInfo.setDescribe2(describe2);
			modelInfo.setDescribe3(describe3);
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemDescribe("("+itemDescribe9+","+itemDescribe10+")");
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemDescribe(itemDescribe9);
			modelInfo.setItemValue(Double.valueOf(itemValue5));
			if(weight != null && !weight.equals(""))modelInfo.setItemWeight(Double.valueOf(weight));
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemNo(describe2);
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemNo(nonFinanItemNo);
			list.add(modelInfo);
		}
		
		if(itemDescribe11!=null &&!itemDescribe11.equals("") && itemDescribe12!=null 
				&&!itemDescribe12.equals("") && itemValue6!=null && !itemValue6.equals("")){
			ModelInfo modelInfo = new ModelInfo();
			modelInfo.setModelId(modelId);
			modelInfo.setDataFlag(dataFlag);
			modelInfo.setDescribe1(describe1);
			modelInfo.setDescribe2(describe2);
			modelInfo.setDescribe3(describe3);
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemDescribe("("+itemDescribe11+","+itemDescribe12+")");
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemDescribe(itemDescribe11);
			modelInfo.setItemValue(Double.valueOf(itemValue6));
			if(weight != null && !weight.equals(""))modelInfo.setItemWeight(Double.valueOf(weight));
			if(dataFlag.equals(ModelInfo.QUANTITY_FACTOR))modelInfo.setItemNo(describe2);
			else if(dataFlag.equals(ModelInfo.QUALITY_FACTOR))modelInfo.setItemNo(nonFinanItemNo);
			list.add(modelInfo);
		}
		
	}
	
	public static void setWeight(Workbook wb){
		if(describe2String == null || describe2String.equals(""))return ;
		double highWeight = getHighWeight(wb);
		if(highWeight == -1) return;
		String weightString;
		Sheet sheetScore = wb.getSheet("得分");
		if(sheetScore != null){
			for(int i = 15; i < 66;i++){
				Cell[] cells = sheetScore.getRow(i);
				if(cells[8].getContents().equals(describe2String)){
					weightString = cells[12].getContents();
					weight = weightString.substring(0, weightString.length() -1 );
					weight = "" + (Double.parseDouble(weight) * highWeight);
				}
			}
		}
	}
	public static double getHighWeight(Workbook wb){
		if(describe1 == null || describe1.equals("")) return -1;
		String highWeightString = null;
		double highWeight = -1;
		Sheet sheetScore = wb.getSheet("得分");
		if(sheetScore != null){
			for(int i=15; i < 66; i++){
				Cell[] cells = sheetScore.getRow(i);
				String s = describe1;
				String c = cells[4].getContents();
				if(cells[4].getContents().equals(describe1)){
					highWeightString = cells[14].getContents();
					//highWeight 将百分比转化成小数
					highWeightString = highWeightString.substring(0, highWeightString.length() - 1);
					double hw= Double.parseDouble(highWeightString);
					highWeight = hw * 0.01;
					break;
				}
			}
		}
		return highWeight;
	}
	public static void setItemValues(){
		if(levelFlag == 'B'){//表明上一个子类因素供有4项
			itemValue1 = "100";
		    itemValue2 = "50";
		    itemValue3 = "";
		    itemValue4 = "";
		    itemValue5 = "";
		    itemValue6 = "";
		}
		if(levelFlag == 'C'){
			itemValue1 = "100";
		    itemValue2 = "67";
		    itemValue3 = "33";
		    itemValue4 = "";
		    itemValue5 = "";
		    itemValue6 = "";
		}
		if(levelFlag == 'D'){
			itemValue1 = "100";
		    itemValue2 = "75";
		    itemValue3 = "50";
		    itemValue4 = "25";
		    itemValue5 = "";
		    itemValue6 = "";
		}
		else if(levelFlag == 'E'){
			itemValue1 = "100";
		    itemValue2 = "80";
		    itemValue3 = "60";
		    itemValue4 = "40";
		    itemValue5 = "20";
		    itemValue6 = "";
		}
		else if(levelFlag == 'F'){
			itemValue1 = "100";
		    itemValue2 = "83";
		    itemValue3 = "66";
		    itemValue4 = "49";
		    itemValue5 = "32";
		    itemValue6 = "15";
		}
	}
	public static void setItemDescribes(String s){
		if(dataFlag.equals(ModelInfo.QUALITY_FACTOR)){
			if(levelFlag == 'A'){
				itemDescribe1 = s;
				itemDescribe2 = s;
			}
			if(levelFlag == 'B'){
				itemDescribe3 = s;
				itemDescribe4 = s;
			}
			if(levelFlag == 'C'){
				itemDescribe5 = s;
				itemDescribe6 = s;
			}
			if(levelFlag == 'D'){
				itemDescribe7 = s;
				itemDescribe8 = s;
			}
			if(levelFlag == 'E'){
				itemDescribe9 = s;
				itemDescribe10 = s;
			}
			if(levelFlag == 'F'){
				itemDescribe11 = s;
				itemDescribe12 = s;
			}
			return ;
		}
		String max = "";
		String min = "";
		boolean inMinArea = true;
		
		for(int i = 0; i < s.length(); i++){
			char curr = s.charAt(i);
			if(curr == '>') inMinArea = true;
			else if(curr == '<') inMinArea = false;
			else if((curr <= '9' && curr >= '0') || curr == '.' || curr == '-'){
				if(inMinArea){
					min = min + curr;
				}
				else{
					max = max + curr;
				}
			}
		}
		if(max.equals("")) max = "10000";
		if(min.equals("")) min = "-10000";

		if(levelFlag == 'A'){
			itemDescribe1 = max;
			itemDescribe2 = min;
		}
		if(levelFlag == 'B'){
			itemDescribe3 = max;
			itemDescribe4 = min;
		}
		if(levelFlag == 'C'){
			itemDescribe5 = max;
			itemDescribe6 = min;
		}
		if(levelFlag == 'D'){
			itemDescribe7 = max;
			itemDescribe8 = min;
		}
		if(levelFlag == 'E'){
			itemDescribe9 = max;
			itemDescribe10 = min;
		}
		if(levelFlag == 'F'){
			itemDescribe11 = max;
			itemDescribe12 = min;
		}
	}
	public static void dataReset(){
//		describeFlag = false; //标识一个子类因素读取
	    describe2String = "";
	    describe2 = "";
	    describe3 = "";
	    
	    itemDescribe1 = "";
	    itemDescribe2 = "";
	    itemDescribe3 = "";
	    itemDescribe4 = "";
	    itemDescribe5 = "";
	    itemDescribe6 = "";
	    itemDescribe7 = "";
	    itemDescribe8 = "";
	    itemDescribe9 = "";
	    itemDescribe10 = "";
	    itemDescribe11 = "";
	    itemDescribe12 = "";
	    
	    itemValue1 = "";
	    itemValue2 = "";
	    itemValue3 = "";
	    itemValue4 = "";
	    itemValue5 = "";
	    itemValue6 = "";
	    
	    weight = "";
		
	}
	

}
